<?php
namespace app\api\controller;
use app\api\controller\Base;
use think\facade\Cache;
use think\Db;
use ztouch\ZeroTouch;
use library\org\net\IpLocation;

class Index extends Base
{
    public function index()
    {
    	// 使用Redis缓存
    	// halt(Db::name('user')->select());
		Cache::store('redis')->set('ztouch_name','nothing',3600);
		$name = Cache::store('redis')->get('ztouch_name');
        return 'hello you get the  api '.$name;
    }

    public function test()
    {
    	$ip		=	$this->request->ip();
    	$Ip = new IpLocation(); // 实例化类
        $location = $Ip->getlocation($ip); // 获取某个IP地址所在的位置
        halt($location);
    }

}
